/*
 * Copyright (c) 2010-2020 IISI.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of IISI.
 */
package com.iisigroup.log.analysis;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 */
public class WSLogAnalysis {
    //================================================
    //== [Enumeration types] Block Start
    //== [Enumeration types] Block End 
    //================================================
    //== [static variables] Block Start
    //== [static variables] Block Stop 
    //================================================
    //== [instance variables] Block Start
    private final static Logger LOGGER = LoggerFactory.getLogger(WSLogAnalysis.class);
    //== [instance variables] Block Stop 
    //================================================
    //== [static Constructor] Block Start
    //== [static Constructor] Block Stop 
    //================================================
    //== [Constructors] Block Start (含init method)
    //== [Constructors] Block Stop 
    //================================================
    //== [Static Method] Block Start
    public static void analysisSiteFolder(final File srcFile,final File appendFile){
        
        for(File unitFile : srcFile.listFiles()){
           
            for(File apFile :unitFile.listFiles()){
                final List<String> lines=new ArrayList<String>();
                String content = new  AnalysisForStuck().getSummaryStuckLog(apFile.listFiles());
                
                lines.add(unitFile.getName());
                lines.add("-------------------");
                lines.add(content);
                try {
                    FileUtils.writeLines(appendFile, lines, appendFile.exists());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    LOGGER.error(e.getMessage(), e);
                }
                lines.clear();
            }
            
        }
       
        ;
    }
    //== [Static Method] Block Stop 
    //================================================
    //== [Accessor] Block Start
    //== [Accessor] Block Stop 
    //================================================
    //== [Overrided Method] Block Start (Ex. toString/equals+hashCode)
    //== [Overrided Method] Block Stop 
    //================================================
    //== [Method] Block Start
    //####################################################################
    
    //## [Method] sub-block : 
    //####################################################################    
    //== [Method] Block Stop 
    //================================================
    //== [Inner Class] Block Start
    //== [Inner Class] Block Stop 
    //================================================
}
